﻿<!doctype html>
 <html lang="zh-CN">
 <head>
   <meta charset="UTF-8">
   <link rel="stylesheet" href="../../../css/common.css">
   <link rel="stylesheet" href="../../../css/main.css">
   <script type="text/javascript" src="../../../js/jquery.min.js"></script>
   <script type="text/javascript" src="../../../js/colResizable-1.3.min.js"></script>
   <script type="text/javascript" src="../../../js/common.js"></script>

  <script type="text/javascript">

    //全选
    /*全选方法*/
    $(function(){

        $("#buttonAll").click(function(){
            /*得到点击按钮的状态*/
            /*jq->js*/
            var status=$(this)[0].checked;
            //设置全选
            var cks=document.getElementsByName("roleId");

            for (var i = 0; i < cks.length; i++) {
                console.log(cks[i])
                cks[i].checked=status;
            }
        })
    });

    //批量删除
    function deleteAll(){
        confirm("确认删除");
        var name = document.getElementsByName("roleId");
        var sum=0;
        for (var i = 0; i <name.length ; i++) {
            if (name[i].checked==true){
                sum=1;
                break;
            }

        }
        if (sum==1) {
            document.getElementById("myMethod").value="deleteAll";
            document.forms[1].submit();
        } else {
            alert("请选择要删除的数据");
        }
    }


    //导出数据
    function excel(){
        confirm("确认导出");
        var name = document.getElementsByName("roleId");
        var sum=0;
        for (var i = 0; i <name.length ; i++) {
            if (name[i].checked==true){
                sum=1;
                break;
            }

        }
        if (sum==1) {
            document.getElementById("myMethod").value = "doExcle";
            document.forms[1].submit();
        } else {
            alert("请选择要导出的数据");
        }
    }
  </script>
</head>
<body>
<form action="/resource/system/role/list" method="post">
     <div id="search_bar" class="mt10">
       <div class="box">
          <div class="box_border">
            <div class="box_top"><b class="pl15">搜索</b></div>
            <div class="box_center pt10 pb10">
              <table class="form_table" border="0" cellpadding="0" cellspacing="0">
                <tr>
                  <td>角色名称</td>
                  <td><input type="text" name="roleName" value="${roleName}" class="input-text lh25" size="10"/></td>
                 
                  
                   <td><input type="submit" name="button" class="btn btn82 btn_search" value="查询"/>
			    <input type="reset" name="button" class="btn btn82 btn_recycle" value="清空"/></td>
                </tr>
               
              </table>
            </div>
        
             <div  class="box_bottom pb5 pt5 pr10" style="border-top:1px solid #dadada;">
              <div class="search_bar_btn" style="text-align:center;" >
                 
                 <a href="/resource/system/role/preAdd" class="ext_btn"><span class="add"></span>添加角色</a>
              </div>
            </div>
			</div>  </div>
			</form>

 <div id="table" class="mt10">
        <div class="box span10 oh">
              <table width="100%" border="0" cellpadding="0" cellspacing="0" class="list_table">
                <tr>
				   <th> <input id="buttonAll" type="checkbox"/></th>
                   <th >角色名称</th>
                   <th >描述</th>
                   <th >状态</th>
				   <th>操作</th>
                    </tr>
                  <form action="/resource/system/role/deleteAndExcle" method="post">
                      <input type="hidden" name="method" id="myMethod">
                      <#list pageInfo.list as role>
                          <tr class="tr" align="center">
                              <td class="td_center">
                                  <input type="checkbox" name="roleId" value="${role.roleId}"/>
                              </td>
                              <td><a href="/resource/system/role/look?roleId=${role.roleId}">${role.roleName}</a></td>
                              <td>${role.roleDesc}</td>
                              <td>
                                  <#if (role.roleStatus==1)>
                                      启用
                                  </#if>
                                  <#if (role.roleStatus==0)>
                                      冻结
                                  </#if>
                              </td>
                              <td>
                                  <#if (role.roleStatus==1)>
                                      <a href="/resource/system/role/updateOne?roleId=${role.roleId}&roleName=${roleName}&page=${pageInfo.pageNum}">禁用</a> |
                                  </#if>
                                  <#if (role.roleStatus==0)>
                                      <a href="/resource/system/role/roleActive?roleId=${role.roleId}&roleName=${roleName}&page=${pageInfo.pageNum}">启用</a> |
                                  </#if>
                                  &nbsp;
                                  <a href="/resource/system/role/preEdit?roleId=${role.roleId}">编辑</a> &nbsp;
                                  <a href="/resource/system/role/deleteOne?roleId=${role.roleId}&roleName=${roleName}&page=${pageInfo.pageNum}">删除</a>
                              </td>
                          </tr>
                      </#list>

                      <td colspan="2"><input type="button" name="button" class="btn btn82 btn_del" value="删除" onclick="deleteAll()">
                          <input type="button" name="button"  class="btn btn82 btn_export" value="导出" onclick="excel()">
                      </td>
                  </form>

               <tr>

				<td colspan="5" align="right">
				     <div class="page mt10">
						<div class="pagination">
						  <ul >
							  <li class="first-child"><a href="/resource/system/role/list?page=1&roleName=${roleName}">首页</a></li>
							  <li class=""><a href="/resource/system/role/list?page=${pageInfo.prePage}&roleName=${roleName}">上一页</a></li>
							 <#-- <li class="active"><span>1</span></li>-->
							  <#--<li><a href="#">2</a></li>
							  <li><a href="#">3</a></li>
							  <li><a href="#">4</a></li>-->
							  <li><a href="/resource/system/role/list?page=${pageInfo.nextPage}&roleName=${roleName}">下一页</a></li>
							  <li ><a href="/resource/system/role/list?page=${pageInfo.pages}&roleName=${roleName}">末页</a></li>
                              <li ><span>第${pageInfo.pageNum}页</span></li>
                              <li ><span>共${pageInfo.total}条数据</span></li>
                              <li ><span>共${pageInfo.pages}页</span></li>
						  </ul>
						</div>
                     </div>
				</td>
			   </tr>
              </table>			  
		
             
        </div>
     </div>

</body>
</html>